<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>步骤表单</title>
    <!-- 依 赖 样 式 -->
    <link rel="stylesheet" href="../module/pear/css/pear.css"/>
</head>
<body class="pear-container">
<form class="layui-form" id="labForm">
    <div class="layui-form-item">
        <label class="layui-form-label">chrome驱动</label>
        <div class="layui-input-block">
            <input type="button" class="pear-btn pear-btn-primary" chromeDriver value="选择文件"/>
            <input type="text" name="driverDir" placeholder="请选择Chrome驱动，默认驱动只支持94版本浏览器"  readonly class="layui-input"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">Chrome浏览器</label>
        <div class="layui-input-block">
            <input type="button" class="pear-btn pear-btn-primary" chickChrome value="选择文件"/>
            <input type="text" name="chromePath" placeholder="请选择Chrome，不选择会从注册表自动获取" readonly class="layui-input"/>
        </div>
    </div>
</form>
</body>
<!-- 依 赖 脚 本 -->
<script src="../module/layui/layui.js"></script>
<script src="../module/pear/pear.js"></script>
<script>
    var index = -1

    function init(d) {
        layui.use(['layer', 'jquery', 'form', 'tool', 'request'], function () {
            let $ = layui.jquery
            let tool = layui.tool
            let request = layui.request
            let form = layui.form
            tool.JsonToHtmlValByName(d, $('#labForm'))
            form.render();

            $('[chromeDriver]').click(function () {
                alert(JSON.stringify({
                    type: 'function',
                    method: 'selectFilePath',
                    data: 'driverDir'
                }))
            })

            $('[chickChrome]').click(function () {
                alert(JSON.stringify({
                    type: 'function',
                    method: 'selectFilePath',
                    data: 'chromePath'
                }))
            })

        })
    }


    function saveDeploy() {
        let $ = layui.jquery
        let tool = layui.tool
        return tool.serializeObject($('#labForm'))
    }


</script>
</html>